package cn.usian.controller;

import cn.usian.pojo.Daily;
import cn.usian.service.DailyVoService;
import cn.usian.vo.DailyVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api/dailyVo")
public class DailyVoController {
    @Autowired
    DailyVoService dailyVoService;

    @RequestMapping("findPage/{pageNum}/{pageSize}")
    public Page<DailyVo> dailyVoPage(
            @PathVariable Integer pageNum,
            @PathVariable Integer pageSize,
            @RequestBody Daily daily
            ){
        return dailyVoService.findPage(pageNum,pageSize,daily);
    }

    @RequestMapping("addDaily")
    public void addDaily(@RequestBody Daily daily){
        dailyVoService.add(daily);
    }

    @RequestMapping("findDaylyById/{id}")
    public Daily findDaylyById(@PathVariable Integer id){
        return dailyVoService.findDaylyById(id);
    }


    @RequestMapping("updateDaily")
    public void updateDaily(@RequestBody Daily daily){
        dailyVoService.updateDaily(daily);
    }
}
